﻿#define PAGE_SIZE
    
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

public class define
{
    public const int PageSize = 20;
    public const string AdminRole = "Administrator";
    public const string DefaultCurrency = "USD";
    public const string DecimalFormat = "#,##0.##";
    public const string ShortDateFormat = "MM/dd/yyyy"; // English
    public const string LongDateFormat = "MM/dd/yyyy hh:mm:ss tt"; // English
    public const string CssNormal = "calendarNormal";
    public const string CssCharter = "calendarCharter";
    public const string CssBooked = "calendarBooked";
    public const string CssBooked2 = "calendarBooked2";
    public const string CssBookedBoat2 = "calendarBookedBoat2";
    public const string CssBooked2Boat2 = "calendarBooked2Boat2";
    public const string CssBlocked = "calendarBlocked";
    public const int ALL = -1;

    public static readonly string[] RateSites = { "http://www.vietcombank.com.vn/exchangerates/", "http://www.vietinbank.vn/web/home/vn/doc/saving/exrate.html", "other(s)" };
    public static readonly string[] Unit = { "pax", "cabin(s)", "other(s)" };
    //public static readonly string[] PaymentMethod = { "Cash", "German A/C", "OnePay", "Trả sau", "Pay pal", "Credit Card", "Handspan" };
    //public static readonly string[] CurrencyType = { "VND", "USD", "EUR" }; // , "JPY", "GBP", "CHF", "AUD", "SGD"
    public static readonly string[] CreditCards = { "Master Card", "Visa", "American Express" };
    public static readonly string[] Services = { "None", "Shared", "Private" };
    public static readonly string[] Status = { "Pending", "Confirmed", "Cancelled" };

}

public enum RESERVATION_STATUS
{
    [StringValue("In Progress")]
    InProgress = 0,
    [StringValue("Cancelled")]
    Cancelled = 1
}

public enum CABIN_STATUS
{
    [StringValue("Booked")]
    Booked = 1,
    [StringValue("Blocked")]
    Blocked = 2,
    [StringValue("Release")]
    Release = 3
}

public enum CurrencyEnum
{
    [StringValue("VND")]
    VND = 0,
    [StringValue("USD")]
    USD = 1,
    [StringValue("EUR")]
    EUR = 2,
    [StringValue("%")]
    Percent = -1
}

public enum PaidMethodEnum
{
    [StringValue("Cash")]
    Cash = 0,
    [StringValue("German Acc")]
    GermanAcc = 1,
    [StringValue("One Pay")]
    OnePay = 2,
    [StringValue("Trả sau")]
    PostPaid = 3,
    [StringValue("Pay Pal")]
    PayPal = 4,
    [StringValue("Credit Card")]
    CreditCard = 5,
    [StringValue("Handspan")]
    Handspan = 6
}

public class StringValue : System.Attribute
{
    private string _value;

    public StringValue(string value)
    {
        _value = value;
    }

    public string Value
    {
        get { return _value; }
    }
}

public static class StringEnum
{
    public static string GetStringValue(this Enum value)
    {
        string output = null;
        Type type = value.GetType();

        //Check first in our cached results...

        //Look for our 'StringValueAttribute' 

        //in the field's custom attributes

        FieldInfo fi = type.GetField(value.ToString());
        StringValue[] attrs =
           fi.GetCustomAttributes(typeof(StringValue),
                                   false) as StringValue[];
        if (attrs.Length > 0)
        {
            output = attrs[0].Value;
        }

        return output;
    }
}